package com.woniuxy.propertyjava.service.impl;

import com.woniuxy.propertyjava.dao.WagesDao;
import com.woniuxy.propertyjava.entity.PageBean;
import com.woniuxy.propertyjava.entity.Wages;
import com.woniuxy.propertyjava.service.WagesService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * Created by IntelliJ IDEA.
 *
 * @Author : author
 * @create 2022/7/7 15:02
 */
@Service
public class WagesServiceImpl implements WagesService {

    @Resource(type = WagesDao.class)
    WagesDao wagesDao;

    @Override
    public PageBean<Wages> getWagesPageBean(Wages wages, int pageIndex, int pageSize) {
        PageBean<Wages> pageBean = new PageBean<>();
        pageBean.setBeanList(wagesDao.selectWagesByStaffProperty(wages, pageIndex, pageSize));
        pageBean.setPageSize(pageSize);
        pageBean.setPageIndex(pageIndex);
        pageBean.setTotalRecode(wagesDao.count(wages));
        return pageBean;
    }

    @Override
    public void insertWages(Wages wages) {
        wagesDao.insert(wages);
    }

    @Override
    public void updateWages(Wages wages) {
        wagesDao.update(wages);
    }

    @Override
    public void deleteWages(int wagesId) {
        wagesDao.deleteById(wagesId);
    }
}
